package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

@Controller

public class myController {
    @RequestMapping("/")
    public String index01(){return"index";}

    /*Controller数据渲染到页面上需要返回ModelAndView类型*/
    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView();
        /*可以设置数据*/
        String data = "这个数据来自controller";
        modelAndView.addObject("data",data);
        /*跳转到index.html*/
        modelAndView.setViewName("index");
        return modelAndView;

    }




}
